package com.lzb.musicplayer.activity;

import android.os.Bundle;
import android.view.View;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.lzb.basic.utils.SPUtil;
import com.lzb.musicplayer.BaseAc;
import com.lzb.musicplayer.Content;
import com.lzb.musicplayer.R;
import com.lzb.musicplayer.databinding.ActivityPlayingBinding;

public class PlayingActivity extends BaseAc<ActivityPlayingBinding> implements View.OnClickListener {


    @Override
    protected int onCreate() {
        return R.layout.activity_playing;
    }

    @Override
    protected void initView() {
        mDataBinding.ivPlayingBack.setOnClickListener(view -> getOnBackPressedDispatcher().onBackPressed());

        mDataBinding.ivOpenMusicInfo.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.ivOpenMusicInfo) {//歌曲信息
            SPUtil.putBoolean(mContext, Content.isOpenMusicInfo, !SPUtil.getBoolean(mContext, Content.isOpenMusicInfo, false));
            mDataBinding.ivOpenMusicInfo.setImageResource(SPUtil.getBoolean(mContext, Content.isOpenMusicInfo, false) ? R.drawable.kai : R.drawable.guan);
        }
    }

    @Override
    protected void initData() {
        boolean isOpen = SPUtil.getBoolean(mContext, Content.isOpenMusicInfo, false);
        mDataBinding.ivOpenMusicInfo.setImageResource(isOpen ? R.drawable.kai : R.drawable.guan);
    }
}